home *** CD-ROM | disk | FTP | other *** search
- -- patroling behaviour -
- -- Created by Sten; 09092002
- --------------------------
-
-
- AIBehaviour.OGPatrolNode = {
- Name = "OGPatrolNode",
- XTime = 0,
- PathStep = 0,
- PatrolPoints = {},
-
-
- Sounds = {
- Ivan = Sound:Load3DSound("SOUNDS/E3DIALOG/i_there_open_fire.wav"),
- Ivan2 = Sound:Load3DSound("SOUNDS/E3DIALOG/i_i-see_him.wav"),
- Steve = Sound:Load3DSound("SOUNDS/e3ai/hey_over_there.wav"),
- Rob = Sound:Load3DSound("SOUNDS/E3DIALOG/r_i_see_him.wav"),
- Rob2 = Sound:Load3DSound("SOUNDS/E3DIALOG/r_target.wav"),
- Rob3 = Sound:Load3DSound("SOUNDS/E3DIALOG/r_move.wav"),
- Ray = Sound:Load3DSound("SOUNDS/E3DIALOG/ry_there_he_is.wav"),
- Ray2 = Sound:Load3DSound("SOUNDS/E3DIALOG/ry_over_there.wav"),
- Ray3 = Sound:Load3DSound("SOUNDS/E3DIALOG/ry_open_fire.wav"),
- },
-
- -- SYSTEM EVENTS -----
-
- ---------------------------------------------
- OnSpawn = function(self,entity )
- local n = 0;
- for n = entity.Properties.pathstart, entity.Properties.pathsteps, 1 do
- tinsert(self.PatrolPoints,n);
- end
- self:AISF_PatrolPath(entity,sender);
- end,
- ---------------------------------------------
- OnSelected = function(self,entity )
- end,
- ---------------------------------------------
- OnActivate = function(self,entity )
- -- self:AISF_PatrolPath(entity,sender);
- end,
- ---------------------------------------------
- OnNoTarget = function( self,entity )
- -- entity:SelectPipe(0,"standingthere");
- end,
- ---------------------------------------------
- OnPlayerSeen = function( self,entity )
- System:LogToConsole(entity:GetName().." .. Seen");
- self.XTime = random(1,9);
- if (self.XTime == 1) then
- entity:Say(self.Sounds.Ivan);
- elseif (self.XTime == 2) then
- entity:Say(entity.Behaviour.Sounds.Ivan2);
- elseif (self.XTime == 3) then
- entity:Say(entity.Behaviour.Sounds.Steve);
- elseif (self.XTime == 4) then
- entity:Say(entity.Behaviour.Sounds.Rob);
- elseif (self.XTime == 5) then
- entity:Say(entity.Behaviour.Sounds.Rob2);
- elseif (self.XTime == 6) then
- entity:Say(entity.Behaviour.Sounds.Rob3);
- elseif (self.XTime == 7) then
- entity:Say(entity.Behaviour.Sounds.Ray);
- elseif (self.XTime == 8) then
- entity:Say(entity.Behaviour.Sounds.Ray2);
- elseif (self.XTime == 9) then
- entity:Say(entity.Behaviour.Sounds.Ray3);
- end
- AI:Signal(SIGNALFILTER_GROUPONLY, 1, "OnPlayerSeenByGroupMember", entity.id);
- self:SurpriseAnimation(entity,sender);
- end,
- ---------------------------------------------
- OnEnemySeen = function(self,entity )
- end,
- ---------------------------------------------
- OnEnemyMemory = function(self,entity )
- end,
- ---------------------------------------------
- OnInterestingSoundHeard = function(self,entity )
- entity:SelectPipe(0,"AIS_investigate");
- end,
- ---------------------------------------------
- OnThreateningSoundHeard = function( self,entity )
- entity:SelectPipe(0,"AIS_investigateThreat");
- end,
- ---------------------------------------------
- OnReload = function(self,entity )
- end,
- ---------------------------------------------
- OnClipNearlyEmpty = function(self,entity )
- -- System:LogToConsole(entity:GetName().." .. OnClipNearlyEmpty");
- end,
- ---------------------------------------------
- OnGroupMemberDied = function(self, entity, sender)
- entity:SelectPipe(0,"AIS_TeamMemberDied", sender.id);
- end,
- ---------------------------------------------
- OnNoHidingPlace = function(self, entity, sender )
- end,
- ---------------------------------------------
- OnReceivingDamage = function ( self, entity, sender)
- -- called when the enemy is damaged
- entity:SelectPipe(0,"AIS_SearchHide_and_Signal");
- end,
- ---------------------------------------------
- OnPlayerSeenByGroupMember = function ( self, entity, sender)
- -- System:LogToConsole(entity:GetName().." .. OnPlayerSeenByGroupMember");
- if (entity ~= sender) then
- entity:SelectPipe(0,"PlayerSeenByGroupMember", sender.id);
- else
- end
- end,
- ----------------------------------------------------FUNCTIONS -------------------------------------------------------------
-
- AISF_CallForHelp = function (self, entity, sender)
- System:LogToConsole(entity:GetName().." .. Got_CallForHelp");
- local target = AI:GetAttentionTargetOf(sender.id);
- System:LogToConsole(entity:GetName().." .. Got_CallForHelp"..target.id);
- entity:SelectPipe(0,"AIS_InvestigateSenderTarget",target.id);
-
- end,
- ------------------------------------------------------------------------
-
- AISF_GoOn = function (self, entity, sender)
- self:AISF_PatrolPath(entity,sender);
- end,
-
- ------------------------------------------------------------------------
-
-
- AISF_PatrolPath = function (self, entity, sender)
- local PrevStep = self.PathStep;
-
- self.PathStep = tremove(self.PatrolPoints,random(1,(entity.Properties.pathsteps-entity.Properties.pathstart)));
- tinsert(self.PatrolPoints,self.PathStep);
-
-
- System:LogToConsole(entity:GetName().." .. Path Step"..self.PathStep);
-
- -- Guard Point
- AI:CreateGoalPipe(entity.Properties.pathname..self.PathStep.."OG_PatrolNode");
- AI:PushGoal(entity.Properties.pathname..self.PathStep.."OG_PatrolNode","run",1,0);
- AI:PushGoal(entity.Properties.pathname..self.PathStep.."OG_PatrolNode","bodypos",1,0);
- AI:PushGoal(entity.Properties.pathname..self.PathStep.."OG_PatrolNode","timeout",1,1);
- AI:PushGoal(entity.Properties.pathname..self.PathStep.."OG_PatrolNode","locate",1,entity.Properties.pathname..self.PathStep);
- AI:PushGoal(entity.Properties.pathname..self.PathStep.."OG_PatrolNode","acqtarget",1,"");
- AI:PushGoal(entity.Properties.pathname..self.PathStep.."OG_PatrolNode","approach",1,0);
- AI:PushGoal(entity.Properties.pathname..self.PathStep.."OG_PatrolNode","timeout",1,0.5);
- AI:PushGoal(entity.Properties.pathname..self.PathStep.."OG_PatrolNode","devalue",0);
- AI:PushGoal(entity.Properties.pathname..self.PathStep.."OG_PatrolNode","timeout",1,3);
- AI:PushGoal(entity.Properties.pathname..self.PathStep.."OG_PatrolNode","AIS_PatrolLook");
- AI:PushGoal(entity.Properties.pathname..self.PathStep.."OG_PatrolNode","timeout",1,3);
- AI:PushGoal(entity.Properties.pathname..self.PathStep.."OG_PatrolNode","signal",0,1,"AISF_PatrolPath",0);
-
- entity:SelectPipe(0,entity.Properties.pathname..self.PathStep.."OG_PatrolNode");
- end,
-
-
- ------------------------------------------------------------------------
- SurpriseAnimation = function (self, entity, sender)
- entity:StartAnimation(0,"recognition");
- entity:SelectPipe(0,"AIS_Delay_1");
- end,
- ------------------------------------------------------------------------
- }
-
-